/**
 * 
 */
package GUI.main;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.JPanel;

import GUI.calendar.CalendarPanel;
import GUI.helpers.ProjectConstants;
import GUI.main.navigation.NavigationMenuPanel;

/**
 * @author mramsey3
 * 
 */
public class MainFrame extends JFrame {

    private static final long serialVersionUID = 1L;
    public static final int WIDTH = 925;
    private static final int HEIGHT = 675;

    private JPanel mainPanel;
    private TopPanel topPanel;
    private JPanel navAndCalendar;
    private NavigationMenuPanel navigationMenuPanel;
    private CalendarPanel calendarPanel;

    /**
     * @param user
     */
    public MainFrame() {
	super();
	setTitle(ProjectConstants.FRAME_TITLE);
	setPreferredSize(new Dimension(WIDTH, HEIGHT));
	setContentPane(getMainPanel());
	final Toolkit toolkit = Toolkit.getDefaultToolkit();
	final Dimension screenSize = toolkit.getScreenSize();
	final int x = (screenSize.width - WIDTH) / 2;
	final int y = (screenSize.height - HEIGHT) / 2;
	setLocation(x, y);
    }

    /**
     * @author mramsey3
     * @return
     */
    public JPanel getMainPanel() {
	if (mainPanel == null) {
	    mainPanel = new JPanel();
	    mainPanel.setLayout(new BorderLayout());
	    mainPanel.add(getTopPanel(), BorderLayout.NORTH);
	    mainPanel.add(getNavAndCalendar(), BorderLayout.CENTER);
	}
	return mainPanel;
    }

    /**
     * @author mramsey3
     * @return
     */
    public TopPanel getTopPanel() {
	if (topPanel == null) {
	    topPanel = new TopPanel();
	}
	return topPanel;
    }

    /**
     * @author mramsey3
     * @return
     */
    public JPanel getNavAndCalendar() {
	if (navAndCalendar == null) {
	    navAndCalendar = new JPanel();
	    navAndCalendar.setLayout(new BorderLayout());
	    navAndCalendar.setPreferredSize(new Dimension(600, 450));
	    navAndCalendar.add(getNavigationMenuPanel(), BorderLayout.WEST);
	    navAndCalendar.add(getCalendarPanel(), BorderLayout.CENTER);
	}
	return navAndCalendar;
    }

    /**
     * @author mramsey3
     * @return
     */
    public NavigationMenuPanel getNavigationMenuPanel() {
	if (navigationMenuPanel == null) {
	    navigationMenuPanel = new NavigationMenuPanel();
	}
	return navigationMenuPanel;
    }

    /**
     * @return
     */
    public CalendarPanel getCalendarPanel() {
	if (calendarPanel == null) {
	    calendarPanel = new CalendarPanel();
	    calendarPanel.setPreferredSize(new Dimension(450, 600));
	}
	return calendarPanel;
    }

}
